home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
libs
/
knowhow4
/
header.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
1994-10-10
|
2KB
|
65 lines
// HEADER.CPP
#include "header.h"
Header::Header(char* h, int ln, BORDERS type, int pat)
{
header = (*h) ? strdup(h) : NULL;
len = ln;
hdr_pattern = pat;
hdr_b_type = type;
}
////////////////////////////
void Header::show(loc begin)
{
if(header == NULL)
return;
int lh = begin.X + area[hdr_b_type].origin.X + area[hdr_b_type].corner.X
+ ((!len) ? textwidth(header) : len);
int lv = begin.Y + area[hdr_b_type].origin.Y + area[hdr_b_type].corner.Y
+ pScreenSet->standart_height + 2;
bar(begin.X + area[hdr_b_type].origin.X,
begin.Y + area[hdr_b_type].origin.Y,
lh - area[hdr_b_type].corner.X,
lv - area[hdr_b_type].corner.Y,
pColorSet->colors.HDR_BAK_COLOR,
pColorSet->colors.FILL_COLOR, (uchar*)pattern[hdr_pattern]);
Carcase::show(hdr_b_type, rect(begin, loc(lh, lv)), 0);
if(textwidth(header) > len)
return;
settextjustify(CENTER_TEXT, CENTER_TEXT);
setcolor(pColorSet->colors.HDR_ATTR_COLOR);
outtextat(loc((begin.X + lh) / 2,
begin.Y + area[hdr_b_type].origin.Y
+ (pScreenSet->standart_height + 2) / 2), header);
}
///////////////////////////////
/*
void demo()
{
Header h("HELLO, World !", 140, BUTTON_BORDER, 16);
h.show(loc(10, 10));
Header h1("HELLO, World !", 150, STANDART_BORDER, 16);
h1.show(loc(10, 50));
Header h2("HELLO, World !", 160, PRESS_BORDER, 16);
h2.show(loc(10, 100));
Header h3("HELLO, World !", 170, SHOW_BORDER, 16);
h3.show(loc(10, 150));
}
void main()
{
if(!init_KNOW_HOW())
return;
demo();
pColorSet->loadColorSet(1);
demo();
pColorSet->loadColorSet(2);
demo();
close_KNOW_HOW();
closegraph();
}
*/